/**
 * 
 */
package com.autonavi.car.si.FileStore.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author kucheng.liao@autonavi.com
 * @date Oct 31, 2014
 * 
 */
public class DateUtil {

	public static String getCurrentDate() {
		String format = ConfigUtil.get("DATE_FORMAT");
		if (null == format) {
			format = "YYYY-MM";
		}
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		return sdf.format(new Date());
	}

	public static Date parseString(String timeStr) throws ParseException {
		if (StringUtil.isNotEmpty(timeStr)) {
			String format = "yyyy-MM-dd HH:mm:ss";
			SimpleDateFormat sdf = new SimpleDateFormat(format);
			return sdf.parse(timeStr);
		}
		return null;
	}
}
